/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package it.univaq.f4i.iw.ex.album.model.impl;

import it.univaq.f4i.iw.ex.album.model.Album;
import it.univaq.f4i.iw.ex.album.model.Comment;
import it.univaq.f4i.iw.ex.album.model.MeetingRoom;
import java.io.InputStream;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

/**
 *
 * @author juli
 */
public class MeetingRoomMysqlImpl implements MeetingRoom {
    private int key;
    private String name;
    private String place;
    private int capacity;
    private List<String> properties;
    private MeetingDataLayerMysqlImpl datalayer;

    MeetingRoomMysqlImpl(MeetingDataLayerMysqlImpl datalayer) {
        key = 0;
        name = "";
        place = "";
        capacity = 0;
        properties = null;
        this.datalayer = datalayer;
    }

    MeetingRoomMysqlImpl(MeetingDataLayerMysqlImpl datalayer, ResultSet data) throws SQLException {
        this.datalayer = datalayer;
        key = data.getInt("ID");
        name = data.getString("name");
        place = data.getString("place");
        capacity = data.getInt("capacity");
        /*????*/
        properties = null;
    }

    public int getKey() {
        return key;
    }

    public void setKey(int key) {
        this.key=key;
    }
    
    public String getName() {
        return name;
    }

    public String getPlace() {
        return place;
    }
    
    public int getCapacity() {
        return capacity;
    }
    /*MODIFICANDO*/
    public List<String> getProperties() {
        if (properties == null) {
            properties = datalayer.getPropertiesMeetingRoom(this);
        }
        return properties;  
    }


    public void setName(String name) {
        this.name = name;
    }

    public void setPlace(String place) {
        this.place = place;
    }

    public void setCapacity(Integer capacity) {
        this.capacity = capacity;
    }
    
    public void setProperties(List<String> prop){
        for(String s : prop){
            properties.add(s);
        }
    }
    
}
